package com.alex.goods.entity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

import com.alibaba.fastjson2.annotation.JSONField;

import lombok.Data;



@Data
public class GoodsOrders {
  
	private Integer id;
	private String goodsNo;
	private String goodsName;
	private String standard;
	private String material;
	
	
	private String orderNo;
	private String factory;
	private BigDecimal singlePrice; // to match the decimal in sql 
	private Integer num;
	private LocalDateTime datetime; // to macth the datetime in sql 
	private String unit;
	private String personName;
	private String tel;
	private String status;
	
	
	@JSONField(format = "yyyy-MM-dd")
    private Date dateio;
	
	public String getStatus() {
		if (status != null && !"".equals(status)) {
			if (status.equals("in")) {
				return "入库";
			} else {
				return "出库";
			}
		}
		return null;
	}

	public String  getDatetime() {
	    return DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(datetime);
	}

}
